package com.yzh.croom.mapper;

import com.yzh.croom.model.domain.Message;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MessageMapper {
    @Results({
            @Result(id = true,column = "id",property = "id"),
            @Result(column = "account",property = "account"),
            @Result(column = "room_id",property = "roomId"),
            @Result(column = "week_id",property = "weekId"),
            @Result(column = "time_id",property = "timeId"),
            @Result(column = "status",property = "status")
    })
    @Select("select * from tb_message")
    public List<Message> getAllMessage();

    @Update("update tb_message  set status = 1 where id=#{id}")
    public int updateById(int id);

    @DeleteProvider(type = MessageSQLProvider.class, method = "deleteMessagesByIds")
    public int deleteMessageByIds(String[] ids);

    @Insert("insert into tb_message (account,reason,room_id,week_id,time_id,date,status) values (#{account},#{reason},#{roomId},#{weekId},#{timeId},#{date},#{status})")
    public int insertMsg(Message message);
}
